import React from "react"

class Hello extends React.Component {
    // 简化语法
    state= {
        count: 0
    }
    handlerState = () => {
        // 正确
        this.setState({
            count: this.state.count + 1
        })    
    }
    render() {
        return (
        <div>
            <div>有状态组件，{this.state.count}</div>
            {/* <button onClick={ this.handlerState.bind(this) }>点击我</button> */}
            <button onClick={ this.handlerState }>点击我</button>
        </div>
        ) 
    } 
}
export default Hello